Changed and Updated for O4A: 18 March 96 (R. Degner)
Table of Contents
Element Class Author Last Update
Clock R. Griesemer 28 Sept 93
Error C. Szyperski 28 Sept 93
Fold H. M
ssenb
ck 28 Sept 93
Graphic C. Szyperski 27 Sept 93
Icon R. Griesemer 1 Oct 93
Info C. Steindl
Line C. Szyperski 28 Sept 93
Link H. M
ssenb
Mark H. M
ssenb
Index M. Hof
Menu N. Wirth 16 Sept 93
Picture H. Marais, K. Rege 7 Feb 91
Popup - "Hypertext without Surprises" M. Franz, S. Ludwig 30 Sept 93
Stamp C. Szyperski 28 Sept 93
Style C. Szyperski 28 Sept 93
Table C. Szyperski 28 Sept 93
Version H. M
ssenb
This documentation is a periodically updated collection of sections describing fully independent text elements. Each section is divided into two subsections: A textual introduction to the functionality of the particular elements, followed by a list of supported commands. For each command, the command name, its explicit and its implicit parameters are given. Potential implicit parameters are the caret, selections, and the marked viewer. Explicit parameters are described using a compact syntax explained in the tutorial Edit.Guide.Text. At the end of each section a list of required files is given.
E-mail update requests to the editor. Implementations of useful new text elements are always welcome.
Companion documentation:
Edit.Guide.Text - Tutorial and Release Notes
Clock Elements
Analog clocks elements displaying the current time (whenever the machine is idle).
command explicit parameters implicit parameters
ClockElems.Insert 9 [number] caret
Insert a clock (with radius given in mm; default is 8) at the caret position.
Error Elements (O4A uses Error Elems from XE)
Fold Elements
Fold Elements can be used to partially and hierarchically fold texts. Folding a text stretch causes its replacement by another, usually shorter or empty text stretch. Unfolding a folded stretch reveils the original text stretch while hiding its replacement. A (partially) folded text may be compiled as if it where fully unfolded using a utility module Folds. Folds also includes the functionality of ErrorElems, as defined elsewhere in this documentation. Options such as the compiler or error message file to be used can be specified in a file Folds.Profile. A demonstration of FoldElems and Folds is available as file FoldDemo.Text.
command explicit parameters implicit parameters
FoldElems.Insert selection
Make selection foldable by inserting an appropriate pair of opening and closing fold elements before and after the selected text stretch, respectively.
FoldElems.Expand marked viewer
Unfolds (expands) all folds contained in the marked text.
FoldElems.Collapse marked viewer
Folds (collapses) all folds contained in the marked text.
Make all fold elements in the marked text visible or invisible.
FoldElems.Search selection, marked viewer
Searches for the selected pattern in the text of the focus viewer starting at the caret position. Searches also within folded parts and opens folds if necessary to display found text stretches. If no selection is present, the last search pattern is used again. If no caret is present, the search starts at the beginning of the text.
Folds.Compile ("^" | "*" [compiler-options] | name [compiler-options])
Compiles the specified text (possibly containing folds). The compiler is started on the fully expanded view of the text.
Folds.ShowError ("*") marked viewer
Places the caret at the next error after the caret position and display an error message in the Log viewer. If no caret is present, the first error in the marked text is displayed.
Folds.SetProfile
Sets the options specified in the file Folds.Profile (which compiler and which error message file should be used; should warnings be displayed). SetProfile is done automatically at the beginning. If Folds.Profile is missing, default options are: Compiler.Compile, OberonErrors.Text, warnings displayed.
Graphics Elements
Graphic elements support incorporation of graphs compatible with the standard Draw package into texts. A single command is provided by module GraphicElems in order to insert a new graphics. Using the middle mouse button, a graphics element can be "opened" for editing. As a result, a graphics viewer is opened displaying the graph. The command GraphicElems.Update in the viewer's menu can be used to propagate changes made to the graph back to the graphics element. Graphic elements support inplace editing: focus the element using the left mouse key and use standard Draw editing techniques within the activated graphics frame.
command explicit parameters implicit parameters
GraphicElems.Insert ("^" | "*" | name) caret (plus marked viewer, if "*" is used)
Inserts a graphics element sized to show the graph stored in graphics file "name". If an open graphics viewer is marked, the command can be used to insert all or part of a displayed graph: if a selection exists in the marked graphics viewer's graph, only the selection is copied into the graphics element.
Icon Elements
Display a small "walking sysiphus" icon. By clicking on such an icon using MM, a screen saver is started. Using an icon editor, the file IconElems.Icon may be changed or replaced to install a different animated icon.
command explicit parameters implicit parameters
IconElems.Insert caret
Inserts a new Icon Element at the caret position.
Info Elements
Info elements are similar to popup menus. When clicking on the element with the middle mouse button, it responds by showing a text. This text contains additional information about the text in which the element is inserted. A typical application is a source module where you would like to add some informations about the programmer and the programming task to the document.
command explicit parameters implicit parameters
InfoElems.Insert caret
Inserts a new Info Element at the caret position.
Hints
The module Find exports a command called AllInfo which can be very useful in combination with InfoElems:
Find.AllInfo ^
searches within the InfoElems of the files specified with Find.Domain. The selection must be of the form item = searchPattern where item is one of {"Title", "Author", "Abstract", "Keywords", "Version", "From", "Until", "Hints", "Changes"}, searchPattern must match exactly or contain asterisks.
E.g.: Find.AllInfo Author = *CS*
Contents of a new InfoElem:
"Title": no title
"Author": no name
"Abstract": no abstract
"Keywords:": no keywords
"Version": no version
"From": 28.10.94 16:59:45
"Until": no date (use StampElems.Insert)
"Hints": This text can again contain arbitrary text elements!
Line Elements
Line elements support horicontal or vertical lines within a text. A single command is provided to insert new line elements. The insertion command takes certain parameters such that line elements can be set to automatically adapt in width and height.
Inserts a line of given or automatically adopted width and height into a text. Width and height may be set in units of 1/10 mm. Otherwise, the width may be set to extend to the end of the current line ("auto") or to the next tabulator position ("tab"). The height may be set to equal the paragraphs line height (determined by the parc's line attribute).
Link Elements
This module provides two kinds of text elements: link elements and link menus.
- A link element represents a hypertext link to a mark element (MarkElems). When the user middle-clicks at the link element the text around the associated mark element is displayed. A middle click at the mark element leads one back to the link element.
- A link menu is an extension of a popup element (PopupElems). It can be used in the menu bar of a viewer. When the user clicks at a link menu, a list of all mark elements in the viewer pops up. By selecting an entry the user can get to any of the mark elements quickly. The list of marks is collected automatically.
For example, the user can invoke the command MarkElems.MarkProcs to insert mark elements in front of all procedure names in procedure declarations. The link menu will then show all these mark elements and the procedure names following them in the text. Of course the user can also insert mark elements explicitly (e.g., in front of type names or variable names). These marks will also be shown in the link menu together with the names following them in the text.
User interaction. A middle click at a link element displays the text around the associated mark element. If the mark element is in the same text as the link element, the text is scrolled to the mark element's position. If it is in a different text, a new viewer is opened showing the mark element and its surrounding text.
A middle-right click at a link element opens a viewer showing the value of the link target (expressed by the tuple <destination file name, mark key>). This text can be edited and stored back to the element with LinkElems.Update from the viewer's menu.
A middle click at a link menu pops up a list of all marks in the viewer's text. By selecting a specific entry the text is scrolled to that mark.
command explicit parameters implicit parameters
LinkElems.Insert caret
inserts a link element at the caret position. The target point of the link is taken from the most recent selection. If a mark element is selected the link goes to that mark element otherwise a new mark element is inserted at the beginning of the selection.
LinkElems.InsertMenu caret
inserts a link menu at the caret position. Link menus should only be used in the menu bar of a viewer.
LinkElems.Update
updates an edited <file name, key> value. See also "middle-right click" above.
Procedures
New(f, k) creates and returns a link element that leads to the mark element with the key k in file f.
FollowLink(f, k, lf, le) follows as link to a mark element with the key k in file f. The frame containing the link element must be given in lf and the link element itself in le. These two parameters are used to establish a backwards link.
It is a good idea to insert a link menu in Edit.Menu.Text, so that a list of all marks can be popped up in all text viewers.
Mark Elements
Mark elements mark a certain position in a text. They are typically used as the target of hypertext links (LinkElems) or as bookmarks. They can be referenced via a numeric key.
User interaction. If one got to a mark element by following a hypertext link, a middle click at this element will lead one back to the source of the link, i.e., to the corresponding link element. A middle+right click will open a viewer showing the element's key. The key can be edited and stored back to the element with MarkElems.Update from the viewer
s menu. This may be useful in rare cases to resolve key ambiguities.
command explicit parameters implicit parameters
MarkElems.Insert caret
inserts a mark element with a new key at the caret position.
MarkElems.Update
updates an edited key value. See also "middle click" above.
MarkElems.ShowNext caret
searches for the next mark element after the caret position and sets the caret to it.
MarkElems.MarkProcs marked viewer
inserts mark elements in front of all procedure declarations in the marked viewer. This is useful in the context of link menus (see LinkElems.Menu) which automatically create links to all mark elements in a text.
Procedures
New() returns a new and initialized mark element that has not been inserted into a text yet.
Index Elements
Index elements work similar to mark elements. They also mark a text position which may be used as the target of hypertext links (LinkElems) or as bookmarks. The added functionality is their ability to automatically create an index of the corresponding text.
User interaction. A middle click will open a viewer showing the text associated with this element. The associated text can be edited and stored back to the element with IndexElems.Update resp. MarkElems.Update from the viewer menus.
command explicit parameters implicit parameters
IndexElems.Insert caret
inserts an index element with a new key at the caret position. The current selection is taken as the associated text. If there is no current selection, the associated text is empty.
IndexElems.Update
updates the edited associated text. See also "middle click" above.
IndexElems.Hide marked viewer
hides all index elements in the marked viewer.
IndexElems.Show marked viewer
redisplays all index elements in the marked viewer.
IndexElems.Index server-name "*" {option}
Generates an Index for the marked viewer. As a side effect, text is printed as well. For a detailed description of available options read the information on Edit.Print. The index is displayed in a separate viewer. It has the following format: <associated text> tab pagenumber <Link Element> {"," pagenumber <Link Element>}.
Picture Elements
Picture elements support incorporation of pictures compatible with the standard Paint package into texts. Using the middle mouse button, a picture element can be "opened" for editing. As a result, a picture viewer is opened displaying the picture. The command PictureElems.Update in the viewer's menu can be used to propagate changes made to the picture back to the picture element.
command explicit parameters implicit parameters
PictElems.Insert ("^" | "*" | name ["scaled"]) caret
Inserts a picture element sized to show the picture stored in picture file "name". If "*" is used, the marked picture is inserted.
Popup Elements - "Hypertext without Surprises"
Popup elements introduce hypertext features into texts. They have commands associated with them which are executed when the elements are clicked. A popup element that executes a single command is also called a "button". Popup Elements are a generalization of the "button" concept found in many hypertext systems in that they present a user with a menu of choices instead of representing only a single command.
A popup element is displayed as a rectangular "button" shape floating in the text. Clicking MM while the mouse points to a button causes the menu of commands associated with the button to appear on the screen. The command that was last chosen from this menu is highlighted and offered as a default. A new command may then be chosen from the menu by moving the mouse over it. The new command becomes highlighted and is executed when the user releases the middle mouse button. At any time, the popup action may be cancelled by releasing MM while the mouse is outside of the menu box or by a click of the left mouse button.
Interclicking MR while a menu is displayed opens a menu-edit viewer. The menu may be edited freely in this viewer. Any changes are propagated instantly to the menu in question. Popup elements may be copied freely among texts. Their complete state, including the last command chosen (the next default) are saved to and restored from disk when the associated document is written or opened.
When a menu command is called, Oberon.Par.text is set to the text of the menu. It is therefore possible to pass parameters to menu commands simply by including them in the menu text. Oberon.Par.vwr is set to the Viewer displaying the text and Oberon.Par.frame to the corresponding frame.
command explicit parameters implicit parameters
PopupElems.Insert string caret
Inserts a new popup element with an initially empty menu. The menu associated with the element may be edited in a menu-edit viewer which is opened by clicking MM on the element with MR interclick. The width of the menu is automatically adjusted to accomodate the widest command, while its line spacing is adjusted automatically to accomodate the largest font in the menu.
Menu Elements
Menu elements are a variant of popup elements. They appear as a simple piece of text (their name) on the screen. If clicked at with MM, a command menu pops up. A Middle-Left-Click at the element causes the menu text to be displayed for editing in a separate viewer. The first line of the menu text is interpreted as the menu name.
command explicit parameters implicit parameters
MenuElems.Insert caret position
Inserts a menu element at the caret position. Initially the element is displayed as a blank rectangle. A Middle-Left-Click displays the (empty) menu text for editing.
MenuElems.Update text in command viewer
This command is usually contained in the menu of the viewer that displays the text of a menu element for editing. It installs the text in the viewer as the new menu text of the element.
Stamp Elements
Display date of most recent store of the text containing the element. (After insertion, StampElems display the current date.) The insert command takes an optional font name which is used to preset the font of the inserted element.
command explicit parameters implicit parameters
StampElems.Insert [name] caret
Inserts a new stamp element, where the name indicated the font to be used. (If name is omitted, the default font is used.)
Style Elements
Style Elements extend standard Parcs by adding a name and automatic conformance of equally named parcs within a text. For example, a parc named "heading" may be set to format a section heading. Then, all parcs with that name use and maintain the same format as changes are propagated automatically.
When copying a style parc from one text to another the behaviour of the copied parc depends on the target text. If it already contains a style with that name, the copied parc will adopt itself to that style. Otherwise, the copied parc defines a new style. Likewise, a style parc may be renamed. If it is renamed to a style that already exists in the containing text, the parc will adopt to that style, while otherwise it introduces a new style.
Some examples for style parcs follow below. Note that the Syntax8.Scn.Fnt file should be available to get nicely labled style parcs.
command explicit parameters implicit parameters
StyleElems.Insert ("^" | name | string) caret
Insert a new style parc with the given name at the caret position. A quoted string may be used to assign names consisting of multiple words.
StyleElems.Rename ("^" | name | string) selected parc
Renames the selected parc to the given name.
Table Elements
Table Elements are automatically formatted tables created from raw, unformatted data. A plain text separated by tabulator characters into columns and by carriage returns into rows can be used to define the table. Furthermore, a certain set of options may be used to modify the default formatting of the table.
Clicking on a table element using MM opens an viewer such that the table contents can be edited. Tables may contain arbitrary text elements, including tables. However, elements incorporated into a table are frozen as is, i.e. messages broadcasted to all visible elements in a text frame are not passed to elements nested into a table. Hence, only static elements should be inserted into tables.
Starting from a defining text containing arbitrary strings separated by tabulator and carriage-return characters, a table is constructed. Tabulators separate columns, carriage-returns separate rows. The separated strings form the contents of table cells. Each such string may in turn contain arbitrary text elements and especially it may contain nested tables. The defining text is bound to a table element and can be edited by clicking on a table with the middle mouse button. In return, a standard text viewer is opened containing an update command in its menu bar. The syntax of the defining text is as follows, table options will be defined later.
table = {option} "/table" {line}.
line = cell {TAB cell} CR.
cell = ["#" | "&"] <string of characters not containing TAB or CR>.
A string starting with a digit, a period (.), or a sign (+ or -) is considered numeric, otherwise it is considered nonnumeric. A number sign (#) prefixing a string is suppressed and enforces numerical interpretation; likewise, an ampersand (&) prefixing a string is suppressed and enforces nonnumerical interpretation. The default table formatting causes all cells in the first column to be formatted left flush. In all other columns, the default format for numeric cells is period-aligned and that for nonnumeric cells is centered. All cells in a row are by default aligned to a common base line. Also, the default format causes the table to be framed and separating lines between rows and columns to be drawn. Finally, for a table with more than two rows or two columns the first row or column separatation line is drawn using two parallel lines, respectively. Most of the default formats can be changed using the provided option set.
For table elements the printing dilemma discussed in section 1.5 needs to be reconsidered. Following the strategy developed for texts, a table would be recasted when printing. However, one of the primary attributes of a table are its measures, i.e. the space taken for individual cells of the table and the arrangement of the cells with respect to each other. It is not acceptable that a table gets completely redimensioned when printed. Hence, for table elements a different printing strategy has been choosen: the displayed table on the screen follows - down to the character level - the metrics of the printer fonts. The resulting screen image looks a bit distorted, however, the displayed measures correspond as closely as possible to the printed ones.
The following table gives an overview over available table formatting options.
option effect (measures in 1/10 mm) argument values
*) A parc at the beginning of the table defining text introduces a minimal
cell height as well as a cell height grid (if the grid option of the parc is set)
Overview of TableElems Options
command explicit parameters implicit parameters
TableElems.Insert ["^" | name] caret
Insert a table defined by the given text at the caret position. If no defining file is given, or the table definition is syntactically erroneous, an empty table is inserted.
TableElems.Update (to be called from menu frame)
Take the viewer's content frame's text as defining text and update the associated table element.